#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    int n;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;
    vector<int> cnt1(26, 0),cnt2(26, 0);
    for(char c : s1){
    	cnt1[c- 'a']++;
    }
    for(char c : s2){
    	cnt2[c - 'a']++;
    }
    for(int i = 0; i < 26; i++){
    	if(cnt1[i] < cnt2[i]){
    		cout << "NO" << '\n';
    		return;
    	}
    }
    cout << "YES" << '\n';
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}